Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multiple format image files for copyToTexture,image_file cases #4135

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

shaoboyan091
Copy link
Contributor

@shaoboyan091 shaoboyan091 commented Jan 9, 2025

This PR added multiple format image file to test CopyEI2T handles HTMLImageElements loaded from them.

The format including coded files: *.png, *.jpg, *.bmp, *.ico, *.gif *.webp, and *.avif
and svg file: *.svg

Issue: #


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

When landing this PR, be sure to make any necessary issue status updates.

…e cases

This PR added multiple format image file to test CopyEI2T handles
HTMLImageElements loaded from them.

The format including coded files: *.png, *.jpg, *.bmp, *.ico, *.gif
*.webp, and *.avif
and svg file: *.svg
@shaoboyan091 shaoboyan091 requested a review from kainino0x January 9, 2025 16:21
@@ -626,7 +626,7 @@ const kFourColorsInfo = {
},
} as const;

export const kImageInfo = makeTable({
export const kEXIFImageInfo = makeTable({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that webp and avif also support EXIF. Not sure about any others. Possibly worth testing in a followup?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, webp indeed support EXIF. AVIF support EXIF but browser(chrome) choose to ignore that part and using irot instead. However, I still invesitigate how to modify irot for avif file.

P.S. I ref to this article https://zpl.fi/exif-orientation-in-different-formats/ and did some experiment locally.

Comment on lines +643 to +645
'four-colors.webp': kFourColorsInfo,
'four-colors.gif': kFourColorsInfo,
'four-colors.avif': kFourColorsInfo,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note, I checked caniuse and it seems to say firefox and safari support webp and avif, so that's probably safe. Still would be worth checking that firefox and ideally safari will load all of these image files, if you haven't (just as standalone images; don't need to worry about whether their webgpu implementation supports them yet)

Copy link
Contributor Author

@shaoboyan091 shaoboyan091 Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Firefox stable(134.0) : All image files are supported.
Safari Stable (18.2) : All image files are supported.

src/webgpu/web_platform/util.ts Show resolved Hide resolved
@shaoboyan091 shaoboyan091 changed the title Add more image files with multiple format for copyToTexture,image_fil… Add multiple format image files for copyToTexture,image_file cases Jan 13, 2025
@kainino0x
Copy link
Collaborator

Are there new changes to review? I don't think I can see them.

However feel free to land this and add more tests in a follow-up PR, if you want.
(I think you have permission to merge, but let me know if not)

@shaoboyan091
Copy link
Contributor Author

@kainino0x No more changes on code but just some infos updates about EXIF things and other brower ability to support image file formats. I think I have the rights to merge it. Will do it after bots finished.

@shaoboyan091 shaoboyan091 merged commit 62838f3 into gpuweb:main Jan 15, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants